package com.cjm.one.goods.client;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.cjm.one.common.constant.ServerConstants;
import com.cjm.one.common.result.Result;
import com.cjm.one.model.goods.entity.GoodsCart;
import com.cjm.one.model.goods.vo.GoodsSkuCartVo;
import io.swagger.v3.oas.annotations.Operation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@FeignClient(value = ServerConstants.SERVER_ONE_GOODS)
public interface GoodsCartClient {
    @GetMapping("/app/goods/cart/list")
    @Operation(summary = "获取购物车列表")
    Result<Page<GoodsSkuCartVo>> getCartList(@RequestParam(value = "current", defaultValue = "1") Integer current,
                                             @RequestParam(value = "size", defaultValue = "10") Integer size);
    @PostMapping("/app/goods/cart/add")
    @Operation(summary = "添加购物车")
    Result<Long> addCart(@RequestBody GoodsCart cart);

    @PostMapping("/app/goods/cart/update")
    @Operation(summary = "更新购物车")
    Result<Boolean> updateCart(@RequestBody GoodsCart cart);

    @DeleteMapping("/app/goods/cart/delete/{id}")
    @Operation(summary = "删除购物车")
    Result<Boolean> deleteCart(@PathVariable("id") Long id);

    @DeleteMapping("/app/goods/cart/delete/all")
    @Operation(summary = "删除购物车全部商品")
    Result<Boolean> deleteCartAll();

    @DeleteMapping("/app/goods/cart/delete/batch")
    @Operation(summary = "批量删除购物车")
    Result<Boolean> deleteCartBatch(@RequestParam("ids") Long[] ids);
    @GetMapping("/app/goods/cart/all/list")
    @Operation(summary = "获取购物车全部商品")
    Result<List<GoodsCart>> getAllCartList();
    @GetMapping("/app/goods/cart/{ids}")
    @Operation(summary = "根据id获取购物车商品")
    Result<Page<GoodsSkuCartVo>> getCart(@PathVariable("ids") Long[] ids);

}
